/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package tRM_LL73.impl;

import bRM_LL73.BRM_LL73;

import genArchi.impl.NodeImpl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import pUNB.PUNB;
import result.Results;

import tRM_LL73.TRM_LL73;
import tRM_LL73.TRM_LL73Package;
import utils.UtilsModelInstance;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>TRM LL73</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link tRM_LL73.impl.TRM_LL73Impl#getPU <em>PU</em>}</li>
 *   <li>{@link tRM_LL73.impl.TRM_LL73Impl#getBound <em>Bound</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class TRM_LL73Impl extends NodeImpl implements TRM_LL73 {
	/**
	 * The cached value of the '{@link #getPU() <em>PU</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPU()
	 * @generated
	 * @ordered
	 */
	protected PUNB pU;

	/**
	 * The cached value of the '{@link #getBound() <em>Bound</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getBound()
	 * @generated
	 * @ordered
	 */
	protected BRM_LL73 bound;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected TRM_LL73Impl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return TRM_LL73Package.Literals.TRM_LL73;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PUNB getPU() {
		if (pU != null && pU.eIsProxy()) {
			InternalEObject oldPU = (InternalEObject)pU;
			pU = (PUNB)eResolveProxy(oldPU);
			if (pU != oldPU) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TRM_LL73Package.TRM_LL73__PU, oldPU, pU));
			}
		}
		return pU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PUNB basicGetPU() {
		return pU;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPU(PUNB newPU) {
		PUNB oldPU = pU;
		pU = newPU;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TRM_LL73Package.TRM_LL73__PU, oldPU, pU));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BRM_LL73 getBound() {
		if (bound != null && bound.eIsProxy()) {
			InternalEObject oldBound = (InternalEObject)bound;
			bound = (BRM_LL73)eResolveProxy(oldBound);
			if (bound != oldBound) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, TRM_LL73Package.TRM_LL73__BOUND, oldBound, bound));
			}
		}
		return bound;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BRM_LL73 basicGetBound() {
		return bound;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setBound(BRM_LL73 newBound) {
		BRM_LL73 oldBound = bound;
		bound = newBound;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, TRM_LL73Package.TRM_LL73__BOUND, oldBound, bound));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case TRM_LL73Package.TRM_LL73__PU:
				if (resolve) return getPU();
				return basicGetPU();
			case TRM_LL73Package.TRM_LL73__BOUND:
				if (resolve) return getBound();
				return basicGetBound();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case TRM_LL73Package.TRM_LL73__PU:
				setPU((PUNB)newValue);
				return;
			case TRM_LL73Package.TRM_LL73__BOUND:
				setBound((BRM_LL73)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case TRM_LL73Package.TRM_LL73__PU:
				setPU((PUNB)null);
				return;
			case TRM_LL73Package.TRM_LL73__BOUND:
				setBound((BRM_LL73)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case TRM_LL73Package.TRM_LL73__PU:
				return pU != null;
			case TRM_LL73Package.TRM_LL73__BOUND:
				return bound != null;
		}
		return super.eIsSet(featureID);
	}
	
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated NOT
	 */
	public void compute() {
					
			/* First case: comparison succeed */
			if ((this.boundLL73 != null && this.pU != null) && this.boundLL73.getValue() >= this.pU.getU()) {
				
				UtilsModelInstance.createSchedulingResult(this, Results.SCHEDULABLE);
			}
			else {
				UtilsModelInstance.createSchedulingResult(this, Results.UNDETERMINED);
			}
	} // compute()

} //TRM_LL73Impl
